package com.caojing.haolemai.ui.mine.gengduo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by sqq on 16/9/28.
 */
public class JpushReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action=intent.getAction();
        Log.i("tag","------action----"+action);
        //接收的是自定义消息
        if(action.equals(JPushInterface.ACTION_MESSAGE_RECEIVED)){
            Bundle bundle=intent.getExtras();
            String message=bundle.getString(JPushInterface.EXTRA_MESSAGE);
            Log.i("tag","--------message-----"+message);
        }else if(action.equals(JPushInterface.ACTION_NOTIFICATION_RECEIVED)){
            //接收的是富媒体或者是通知消息
            Bundle bundle=intent.getExtras();
            String title=bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
            String content=bundle.getString(JPushInterface.EXTRA_ALERT);
            Log.i("tag","title------"+title+",--------content------"+content);
            //获取推送的键值对消息
            String extra=bundle.getString(JPushInterface.EXTRA_EXTRA);
            Log.i("tag","------extra------"+extra);
        }
    }
}










